package com.mingqijia.gassafety.shared.constant;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 探测器 气体类型
 *  T-甲烷;M-一氧化碳;Y-丙烷;Q-其他
 */
@Getter
@RequiredArgsConstructor
public enum GasTypeEnum {
    CH4("甲烷", "T"),
    CO("一氧化碳", "M"),
    CH3CH2CH3("丙烷", "Y"),
    OTHER("其他", "Q");

    private final String name;

    private final String gasType;

    public static String getName(String gasType) {
        if (gasType == null) {
            return null;
        }
        for (GasTypeEnum gasTypeEnum : GasTypeEnum.values()) {
            if (gasTypeEnum.gasType.equals(gasType)) {
                return gasTypeEnum.name;
            }
        }
        return null;
    }
}
